package com.june.springframework.pubsub;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

public class TextMessageListener implements MessageListener {

	@Override
	public void onMessage(Message message) {
		if (!(message instanceof TextMessage)) {
			System.out.println("消息类型不正确，不予处理");
			return;
		}
		TextMessage textMessage = (TextMessage) message;
		if (textMessage != null) {
			try {
				System.out.println("接收到订阅的消息：" + textMessage.getText());
			} catch (JMSException e) {
				e.printStackTrace();
			}
		}
	}

}
